//
//  AboutUsViewController.m
//  CarLifes
//
//  Created by yu on 2017/8/11.
//  Copyright © 2017年 jpas. All rights reserved.
//

#import "AboutUsViewController.h"

@interface AboutUsViewController ()

@property (nonatomic, strong) UIScrollView *scrollView;

@end

@implementation AboutUsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"关于我们";
    
    [self setupSubview];
    
    //1.设置颜色
//    self.navigationController.navigationBar.layer.shadowColor = [UIColor grayColor].CGColor;
//    
//    //2.设置阴影偏移范围
//    self.navigationController.navigationBar.layer.shadowOffset = CGSizeMake(0, 3);
//    
//    //3.设置阴影颜色的透明度
//    self.navigationController.navigationBar.layer.shadowOpacity = 0.5;
//    
//    //4.设置阴影半径
//    self.navigationController.navigationBar.layer.shadowRadius = 3;
//    
//    //5.设置阴影路径
//    self.navigationController.navigationBar.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.navigationController.navigationBar.bounds].CGPath;
}

- (void)setupSubview
{
    UIScrollView *scrollView = [[UIScrollView alloc] init];
    scrollView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    scrollView.alwaysBounceVertical = YES;
    [self.view addSubview:scrollView];
    
    scrollView.sd_layout.spaceToSuperView(UIEdgeInsetsZero);
    
    UIImageView *imageView = [[UIImageView alloc] init];
    imageView.image = IMAGE_NAMED(@"about_us");
    [scrollView addSubview:imageView];
    
    imageView.sd_layout
    .centerXEqualToView(scrollView)
    .topSpaceToView(scrollView, 30)
    .heightIs(95)
    .widthEqualToHeight();
    
    NSString *appver = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
    
    UILabel *versionLabel = [self setupLabelWithTitle:NSStringFormat(@"当前版本号：%@",appver) font:15 textColor:kRgb(173, 173, 173)];
    [versionLabel setSingleLineAutoResizeWithMaxWidth:200];
    [scrollView addSubview:versionLabel];

    
//    UIButton *noteButton = [[UIButton alloc] init];
//    [noteButton setTitle:@"版本说明" forState:UIControlStateNormal];
//    [noteButton setTitleColor:[UIColor baseCLTextBlackColor] forState:UIControlStateNormal];
//    noteButton.titleLabel.font = SYSTEM_FONT(18);
//    [noteButton setImage:IMAGE_NAMED(@"arrow_right") forState:UIControlStateNormal];
//    [noteButton setBackgroundColor:[UIColor whiteColor]];
//    [noteButton addTarget:self action:@selector(noteAction) forControlEvents:UIControlEventTouchUpInside];
//    [scrollView addSubview:noteButton];
    
    
    versionLabel.sd_layout
    .centerXEqualToView(imageView)
    .topSpaceToView(imageView, 20)
    .heightIs(20);
    
//    noteButton.sd_layout
//    .leftEqualToView(scrollView)
//    .rightEqualToView(scrollView)
//    .topSpaceToView(versionLabel, 30)
//    .heightIs(50);
//
//    noteButton.titleLabel.sd_layout
//    .leftSpaceToView(noteButton, 18)
//    .centerYEqualToView(noteButton)
//    .widthRatioToView(noteButton, 1);
//
//    noteButton.imageView.sd_layout
//    .rightSpaceToView(noteButton, 18)
//    .centerYEqualToView(noteButton)
//    .widthIs(8)
//    .heightIs(14);
    
    [scrollView setupAutoContentSizeWithBottomView:versionLabel bottomMargin:0];
}


- (void)noteAction
{

}

- (UILabel *)setupLabelWithTitle:(NSString *)title font:(CGFloat)font textColor:(UIColor *)textColor
{
    UILabel *label = [[UILabel alloc] init];
    label.text = title;
    label.font = [UIFont systemFontOfSize:font];
    label.backgroundColor = [UIColor clearColor];
    label.textColor = textColor;
    return label;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
